#include "conversemessagegetsessions.h"

namespace Converse {
MessageGetSessions::MessageGetSessions(const long idChanel,
                                       const long fid, QObject *parent)
    : m_idChanel(idChanel),
      m_fid(fid),
      Network::ConnectionJSONRequest(parent)
{
}

QString MessageGetSessions::commandId() const
{
    QString commandid;
    long id = m_idChanel;

    switch(id){
    case -1:
        commandid = "2001";
        break;
    case 0:
        commandid = "1009";
        break;
    case 1:
        commandid = "2004";
        break;
    default:
        commandid = "0";
        break;
    }

    return commandid;

}
QVariant MessageGetSessions::data() const
{
    QVariantMap map;
    long id = m_idChanel;

    QVariant v;
    v.setValue(m_fid);

    switch(id){
    case -1:
    //{"cmd":"1009","data":{"idx":"0","c":"10"}}
    case 0:
        map.insert("c", "20");
        map.insert("idx", QString("0"));
        break;
    //{"cmd":"2004","data":{"to":"10","c":"2","idx":"1","idt":"1"}}
    case 1:
        map.insert("to", v.toString());
        map.insert("c", "20");
        map.insert("idx", "1");
        map.insert("idt", "1");
        break;
    default:
        break;

    }
    return map;
}

}

